package com.SyDeck.sdRPGmod.Interface;

import java.lang.reflect.Field;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer;
import net.minecraft.server.MinecraftServer;

/**
 *
 * @author Deck & Sammy
 */
public class ConsoleHandler {

    public static boolean queueConsoleCommand(Server server, String cmd) {
        try {
            Field f = CraftServer.class.getDeclaredField("console");
            f.setAccessible(true);
            MinecraftServer ms = (MinecraftServer) f.get(server);

            if ((!ms.g) && (MinecraftServer.a(ms))) {
                ms.a(cmd, ms);
                return true;
            }
        } catch (Exception e) {
        }
        return false;
    }
}
